﻿/****** Object:  Table [GP].[ControlloAccessoVerniciatori]    Script Date: 10/24/2013 19:35:39 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [GP].[ControlloAccessoVerniciatori](
	[IDTurno] [smallint] NOT NULL,
	[IDImpianto] [int] NOT NULL,
	[IDOperatore] [uniqueidentifier] NULL,
	[IsBlocked] [bit] NOT NULL,
 CONSTRAINT [PK_ControlloAccessoVerniciatori_1] PRIMARY KEY CLUSTERED 
(
	[IDTurno] ASC,
	[IDImpianto] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [GP].[ControlloAccessoVerniciatori]  WITH CHECK ADD  CONSTRAINT [FK_ControlloAccessoVerniciatori_aspnet_Users] FOREIGN KEY([IDOperatore])
REFERENCES [dbo].[aspnet_Users] ([UserId])
GO

ALTER TABLE [GP].[ControlloAccessoVerniciatori] CHECK CONSTRAINT [FK_ControlloAccessoVerniciatori_aspnet_Users]
GO

ALTER TABLE [GP].[ControlloAccessoVerniciatori]  WITH CHECK ADD  CONSTRAINT [FK_ControlloAccessoVerniciatori_Impianti] FOREIGN KEY([IDImpianto])
REFERENCES [GP].[Impianti] ([IDImpianto])
GO

ALTER TABLE [GP].[ControlloAccessoVerniciatori] CHECK CONSTRAINT [FK_ControlloAccessoVerniciatori_Impianti]
GO

ALTER TABLE [GP].[ControlloAccessoVerniciatori]  WITH CHECK ADD  CONSTRAINT [FK_ControlloAccessoVerniciatori_Turni] FOREIGN KEY([IDTurno])
REFERENCES [GP].[Turni] ([IDTurno])
GO

ALTER TABLE [GP].[ControlloAccessoVerniciatori] CHECK CONSTRAINT [FK_ControlloAccessoVerniciatori_Turni]
GO

